package com.gxa.controller.fwgl.yhgl;

import com.gxa.mapper.fwgl.yhgl.GooutMapper;
import com.gxa.pojo.dto.fwgl.CheckInDto;
import com.gxa.pojo.dto.fwgl.NormalInDto;
import com.gxa.pojo.entity.fwgl.TCheckOut;
import com.gxa.pojo.entity.fwgl.TGoout;
import com.gxa.service.fwgl.yhgl.CheckOutService;
import com.gxa.service.fwgl.yhgl.GooutService;
import com.gxa.utils.QueryResult;
import com.gxa.utils.Result;
import com.gxa.utils.ResultUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author：lizhijun
 * @Package：{PROJECT_NAME}
 * @name：{DATE} {NAME}
 */
@RestController
@RequestMapping("/goout")
public class GooutController {
    @Resource
    private GooutService gooutService;

    @GetMapping("/queryAll")
    public Result queryAll(NormalInDto normalInDto){
        QueryResult queryResult = gooutService.queryAll(normalInDto);
        return ResultUtils.buildSuccess(queryResult.getData(),queryResult.getCount());
    }

    @RequestMapping("/add")
    public Result addGoout(TGoout goout){
        gooutService.add(goout);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/update")
    public Result updateGoout(TGoout goout){
        gooutService.update(goout);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/delete")
    public Result deleteGoout(Integer id){
        gooutService.delete(id);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/find")
    public Result findTypeByName(String patientName){
        gooutService.findByName(patientName);
        return ResultUtils.buildSuccess();
    }

}
